package com.baidu.mapapi;

import android.graphics.Point;
import android.os.Message;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;

public class MapController
  implements View.OnKeyListener
{
  private MapView a = null;

  MapController(MapView paramMapView)
  {
    this.a = paramMapView;
    paramMapView.b.setOnKeyListener(this);
  }

  public void animateTo(GeoPoint paramGeoPoint)
  {
    this.a.a(paramGeoPoint, null, null);
  }

  public void animateTo(GeoPoint paramGeoPoint, Message paramMessage)
  {
    this.a.a(paramGeoPoint, paramMessage, null);
  }

  public void animateTo(GeoPoint paramGeoPoint, Runnable paramRunnable)
  {
    this.a.a(paramGeoPoint, null, paramRunnable);
  }

  public boolean onKey(View paramView, int paramInt, KeyEvent paramKeyEvent)
  {
    if ((this.a.b != paramView) || (paramKeyEvent.getAction() != 0))
      return false;
    switch (paramInt)
    {
    default:
      return false;
    case 19:
      scrollBy(0, -50);
    case 21:
    case 22:
    case 20:
    }
    while (true)
    {
      return true;
      scrollBy(-50, 0);
      continue;
      scrollBy(50, 0);
      continue;
      scrollBy(0, 50);
    }
  }

  public void scrollBy(int paramInt1, int paramInt2)
  {
    if ((paramInt1 == 0) && (paramInt2 == 0))
      return;
    this.a.b(paramInt1, paramInt2);
  }

  public void setCenter(GeoPoint paramGeoPoint)
  {
    this.a.a(paramGeoPoint);
  }

  public int setZoom(int paramInt)
  {
    this.a.a(paramInt);
    return this.a.getZoomLevel();
  }

  public void stopAnimation(boolean paramBoolean)
  {
    this.a.a(paramBoolean);
  }

  public void stopPanning()
  {
    setCenter(this.a.getMapCenter());
  }

  public boolean zoomIn()
  {
    return this.a.f();
  }

  public boolean zoomInFixing(int paramInt1, int paramInt2)
  {
    GeoPoint localGeoPoint = this.a.getProjection().fromPixels(paramInt1, paramInt2);
    boolean bool = zoomIn();
    if (bool)
    {
      Point localPoint = new Point();
      this.a.getProjection().toPixels(localGeoPoint, localPoint);
      scrollBy(localPoint.x - paramInt1, localPoint.y - paramInt2);
    }
    return bool;
  }

  public boolean zoomOut()
  {
    return this.a.g();
  }

  public boolean zoomOutFixing(int paramInt1, int paramInt2)
  {
    GeoPoint localGeoPoint = this.a.getProjection().fromPixels(paramInt1, paramInt2);
    boolean bool = zoomOut();
    if (bool)
    {
      Point localPoint = new Point();
      this.a.getProjection().toPixels(localGeoPoint, localPoint);
      scrollBy(localPoint.x - paramInt1, localPoint.y - paramInt2);
    }
    return bool;
  }

  public void zoomToSpan(int paramInt1, int paramInt2)
  {
    this.a.a(paramInt1, paramInt2);
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.baidu.mapapi.MapController
 * JD-Core Version:    0.6.2
 */